﻿#ifndef DOWNLOADMQ_H
#define DOWNLOADMQ_H

#include <QObject>
#include <iostream>
#include <QMap>
#include <QMutexLocker>
#include <QMutex>
#include <QSet>
#include <QUrl>
#include <QDir>
#include <QJsonObject>
#include <QJsonDocument>
#include <QJsonParseError>
#include <QTcpSocket>
#include <QFile>
#include "qtredis.h"
#include "command.h"


using namespace std;

class DownloadMQ : public QObject
{
    Q_OBJECT
public:
    ~DownloadMQ();
    static DownloadMQ* Instance();
    void download(QString url);
    bool getFile(QString url,CFile& file);
signals:
    
    
private:
    explicit DownloadMQ(QObject *parent = nullptr);
    
    static DownloadMQ* instance;  //单例
    static QMutex mutex;          //单例锁
    
    QMutex dmutex;  //下载锁
    
    QMap<QString,CFile> map_downloadStore;
    QSet<QString> set_downloadMQ;
    
};

#endif // DOWNLOADMQ_H
